package com.example.designPattern.factory.order;

import com.example.designPattern.factory.pizza.ChinesePizza;
import com.example.designPattern.factory.pizza.GreePizza;
import com.example.designPattern.factory.pizza.Pizza;

/**
 * pizza工厂类
 * 只负责制造pizza
 */
public class PizzFactory {

    public Pizza creatPizza(String orderType){
        System.out.println("使用简单工厂模式");
        Pizza pizza = null;
        if (orderType.equals("gree")){
            pizza = new GreePizza();
            pizza.setName("greePizza");
        }else if (orderType.equals("chinese")){
            pizza = new ChinesePizza();
            pizza.setName("Chinese");
        }
        return pizza;
    }
}
